
package io.renren.modules.job.xxljob;

import com.xxl.job.core.context.XxlJobContext;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.stereotype.Component;


/**
 * @Author: LiuZhen
 * @Created: 2021/7/1 22:09
 * @Description:
 */

@Component
public class TestJob {

    /**
     * 1、简单任务示例（Bean模式）
     */

    @XxlJob("renrenJob")
    public void demoJobHandler() throws Exception {
        XxlJobHelper.log("XXL-JOB, Hello World.");
        XxlJobContext context = XxlJobContext.getXxlJobContext();
        String param = XxlJobHelper.getJobParam();
        System.out.println(param);

        for (int i = 0; i < 5; i++) {
            XxlJobHelper.log("beat at:" + i);
            System.out.println(i);

        }
        // default success
    }

}

